const cloud = require('wx-server-sdk')
cloud.init()
const db = cloud.database()
exports.main = async(event, context) => {
  let pageSize=event.pageSize;
  let pageNo=event.pageNo;
  try {
    return await db.collection('todos').where().skip(pageNo*pageSize).limit(pageSize).get()
  } catch (e) {
    console.error(e)
  }
}